#ifndef _CAMERA_H_
#define _CAMERA_H_

#include "Math.h"

#define PI 3.14159f

class Camera
{
public:
	Vector3 m_position;
	Vector3 m_target;
	GLfloat m_nearPlane;
	GLfloat m_farPlane;
	GLfloat m_fovY;
	GLfloat m_aspect;

	//parameters
	Vector3 m_up;
	Vector3 m_xaxis;
	Vector3 m_yaxis;
	Vector3 m_zaxis;

	Matrix m_VP;
	Matrix m_V;
	Matrix m_W;
	Matrix m_P;

	GLfloat m_angleV;
	GLfloat m_zoomLevel;
	GLfloat m_standardLength;
	GLfloat m_moveSpeed;
	GLfloat m_rotateSpeed;
	GLfloat m_zoomSpeed;

	bool m_bHasChanges;

protected:
	void UpdateAxis();
	void UpdateW();
	void UpdateVP();

public:
	Camera();
	Matrix & VPMatrix();
	void UpdateAllParams();
	void Update(float deltaTime );

	void SetPerspective(GLfloat fovY, GLfloat aspect, GLfloat nearPlane, GLfloat farPlane);
	void SetPositionTarget(Vector3& pos, Vector3& target);

	//control function
	void MoveForwardBackward();
	void MoveLeftRight();
	void RotateUpDown();
	void RotateLeftRight();
	void ZoomInOut();
};

typedef std::vector<Camera *> CameraVector;

#endif